package com.gary;

import java.util.HashMap;
import java.util.Map;
import java.util.function.IntConsumer;

/**
 * @author peng_rui
 * @date 2022/10/9
 */
public class MeiTuan3 {
    public static void main(String[] args) {

        Integer a = 300;
        Integer b = 300;

        System.out.println(a == b);
//        String ver1 = "1.2";
//        String ver2 = "1.2.0";
//
//        String url = "http://abc.com/v1?age=%d&name=%s";
//        Map<String, Object> map = new HashMap<>(16);
//        map.put("age", 18);
//        map.put("name", "pengrui");
//        String path = meth(url, map);
//        System.out.println(path);
    }

    public static final int Big = 1;
    public static final int Small = 2;
    public static final int Eq = 0;

    public static String  getPath(String url, Map map) {
        String urlPre = url.substring(0, url.indexOf("?") + 1);
        String paramUrl = url.substring(url.indexOf("?") + 1);
        String[] param = paramUrl.split("&");
        StringBuilder sb = new StringBuilder(urlPre);
        for (int i = 0; i < param.length; i++) {
            String paramName = param[i].substring(0, param[i].indexOf("="));
            Object value = map.get(paramName);
            String pa = paramName + "=" + value + "&";
            sb.append(pa);
        }

        return sb.toString();
    }

    public static int comp2(String v1, String v2) {
        String[] vs1 = v1.split("\\.");
        String[] vs2 = v2.split("\\.");
        if (vs1.length == vs2.length) {
            for (int i = 0; i < vs1.length; i++) {
                if (Integer.valueOf(vs1[i]) > Integer.valueOf(vs2[i])) {
                    return Big;
                }
                if (Integer.valueOf(vs1[i]) < Integer.valueOf(vs2[i])) {
                    return Small;
                }
            }
        } else {

        }
        return Eq;
    }

    public static int comp(String v1, String v2) {
        String[] vs1 = v1.split("\\.");
        String[] vs2 = v2.split("\\.");
        if (Integer.valueOf(vs1[0]) > Integer.valueOf(vs2[0])) {
            return Big;
        }
        if (Integer.valueOf(vs1[0]) < Integer.valueOf(vs2[0])) {
            return Small;
        }
        if (Integer.valueOf(vs1[0]).equals(Integer.valueOf(vs2[0]))) {
            if (Integer.valueOf(vs1[1]) > Integer.valueOf(vs2[1])) {
                return Big;
            }
            if (Integer.valueOf(vs1[1]) < Integer.valueOf(vs2[1])) {
                return Small;
            }
            if (Integer.valueOf(vs1[1]).equals(Integer.valueOf(vs2[1]))) {
                if (Integer.valueOf(vs1[2]) > Integer.valueOf(vs2[2])) {
                    return Big;
                }
                if (Integer.valueOf(vs1[2]) < Integer.valueOf(vs2[2])) {
                    return Small;
                }
            }
        }
        return Eq;
    }
}
